//
//  SNewsMyThreeTableViewCell.m
//  News
//
//  Created by dlios on 15-5-14.
//  Copyright (c) 2015年 PEAK. All rights reserved.
//

#import "SNewsMyThreeTableViewCell.h"

@implementation SNewsMyThreeTableViewCell

-(void)dealloc
{
    
    [_cellImageView release];
    [_cellLabelOne release];
    [_cellLabelTwo release];
    [_cellLabelThree release];
    [_modelTwo release];
    [super dealloc];
}

- (void)awakeFromNib {
    // Initialization code
}

-(instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
    
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        self.cellImageView = [[UIImageView alloc] init];
//        _cellImageView.backgroundColor = [UIColor redColor];
        [self.contentView addSubview:_cellImageView];
        [_cellImageView release];
        
        self.cellLabelOne = [[UILabel alloc] init];
        _cellLabelOne.backgroundColor = [UIColor grayColor];
       
        _cellLabelOne.numberOfLines = 0;
        
        _cellLabelOne.textAlignment = NSTextAlignmentLeft;
        [self.contentView addSubview:_cellLabelOne];
        [_cellLabelOne release];
        
        self.cellLabelTwo = [[UILabel alloc] init];
        
        _cellLabelTwo.textAlignment = NSTextAlignmentLeft;
        _cellLabelTwo.backgroundColor = [UIColor whiteColor];
        _cellLabelTwo.numberOfLines = 0;
        [self.contentView addSubview:_cellLabelTwo];
        [_cellLabelTwo release];
        
        self.cellLabelThree = [[UILabel alloc] init];
        _cellLabelThree.textAlignment = NSTextAlignmentLeft;
        _cellLabelThree.backgroundColor = [UIColor whiteColor];
        
//        _cellLabelThree.text = @"laiyuan";
        [self.contentView addSubview:_cellLabelThree];
        [_cellLabelThree release];
    }
    
    return self;
    
}


-(void)layoutSubviews
{
    
    [super layoutSubviews];
    
  
    
    _cellImageView.frame = CGRectMake(0, 5, self.contentView.frame.size.width / 3.1, self.contentView.frame.size.height - 5);
    
    _cellLabelOne.frame = CGRectMake(_cellImageView.frame.size.width + 10, 10, self.contentView.frame.size.width -  _cellImageView.frame.size.width, 20);
    
    _cellLabelTwo.frame = CGRectMake(_cellImageView.frame.size.width + 10, _cellLabelOne.frame.size.height + 20 , self.contentView.frame.size.width -  _cellImageView.frame.size.width, 40);
    
    _cellLabelThree.frame = CGRectMake(_cellImageView.frame.size.width + 20, _cellLabelTwo.frame.size.height + 60, self.contentView.frame.size.width / 4.6, 20);

}


-(void)setModelTwo:(SNewsTwo *)modelTwo
{
    if (modelTwo != _modelTwo) {
        [_modelTwo release];
        _modelTwo = [modelTwo retain];
        
    }
    NSURL * url = [NSURL URLWithString:modelTwo.imgsrc];
    [_cellImageView sd_setImageWithURL:url placeholderImage:[UIImage imageNamed:@"``_3(NZ4U{L@4L7FN0J70DA"]];
    
    _cellLabelOne.text = modelTwo.title;
    _cellLabelTwo.text = modelTwo.digest;
    _cellLabelThree.text = modelTwo.TAGS;
    

    
}



- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
